package org.nerdpod.feed.server;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.nerdpod.feed.FeedHelper;
import org.nerdpod.feed.IncidentBean;

@SuppressWarnings("serial")
public class TestServiceImpl extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {
        resp.setContentType("text/html");
        resp.getWriter().println("Ushahidi Test Feed<br/><small>svwebbuilder.com<br/>nerdpod.org</smal><br/><br/>");
        resp.getWriter().println("<pre>");
        List<IncidentBean> incidents = FeedHelper.getIncidents();
        resp.getWriter().println("Found " + incidents.size() + " incidents.");
        for(IncidentBean incident: incidents) {
        	resp.getWriter().println(
        			incident.getIncidentDate() + "," +
//        			incident.getDescription() + "," +
        			incident.getTitle() + "," + 
        			incident.getUri() + "," +
        			incident.getLocation());
        }
//        resp.getWriter().println(FeedHelper.getFeedCsv());
        resp.getWriter().println("</pre>");
    }
}